package com.zyx.javademo.nio.path;

import java.nio.file.Path;
import java.nio.file.Paths;

/**
 * @author zyx
 * @since 2021/9/18 13:57
 */
public class PathDemo {
    public static void main(String[] args) {
        // 创建path实例
        Path path = Paths.get("input/nio/read01.txt");

        // 创建相对路径
        // 代码1
        Path projects = Paths.get("input/nio", "read01.txt");

        // 代码2
        Path file = Paths.get("input", "nio/read01.txt");


        String originalPath = "input/../input/nio/read01.txt";

        Path path1 = Paths.get(originalPath);
        System.out.println("path1 = " + path1);

        Path path2 = path1.normalize();
        System.out.println("path2 = " + path2);

    }
}
